﻿using System;
using System.Configuration;
using System.Web;
using System.Collections;
using Fjaspx.Common;
namespace Fjaspx.UI.Web
{
    public class AdminStatus : System.Web.IHttpModule 
    {
        /// <summary>
        /// 初始化模块，并使其为处理请求做好准备。
        /// </summary>
        /// <param name="context">一个 <see cref="T:System.Web.HttpApplication"/>，它提供对 ASP.NET 应用程序内所有应用程序对象的公用的方法、属性和事件的访问</param>
        public void Init(HttpApplication context)
        {
            context.BeginRequest += new EventHandler(context_BeginRequest);
        }

        /// <summary>
        /// Handles the BeginRequest event of the context control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void context_BeginRequest(object sender, EventArgs e)
        {
            HttpApplication application = (HttpApplication)sender;
            HttpContext context = application.Context;
            //HttpContext context = ((HttpApplication)sender).Context; 
            // 获取旧的Url 
            string url = context.Request.Path.ToLower();
            // 重写Url 
            context.RewritePath("index.html");


        }

        /// <summary>
        /// 处置由实现 <see cref="T:System.Web.IHttpModule"/> 的模块使用的资源（内存除外）。
        /// </summary>
        public void Dispose()
        {
        } 

    }
}
